package javatest;

import jdk.internal.dynalink.beans.StaticClass;

/**
 * 类加载顺序测试
 * 内部类加载时机
 * 内部静态类加载时机
 */
public class ClassLoadOrderTest {

    public static long OUTER_DATE = System.currentTimeMillis();

    static {
        System.out.println("外部类静态块加载时间：" + System.currentTimeMillis());
    }

    public ClassLoadOrderTest() {
        System.out.println("外部类构造函数时间：" + System.currentTimeMillis());
    }

    static class InnerStaticClass {
        public static long INNER_STATIC_DATE = System.currentTimeMillis();

        static {
            System.out.println("静态内部类静态块加载时间：" + System.currentTimeMillis());
        }
        InnerStaticClass() {
            System.out.println("静态内部类构造方法加载时间：" + System.currentTimeMillis());
        }
    }

    class InnerClass {
        public long INNER_DATE = 0;

        {
            System.out.println("内部类静态变量加载时间：" + System.currentTimeMillis());
        }

        public InnerClass() {
            INNER_DATE = System.currentTimeMillis();
        }
    }
}
